(function(angular){
  var appService=angular.module("userService",[]);
  appService.service("myService",function($http){
    /**
     * 用户登录验证
     * @param params
     * @returns {*}
     */
    this.queryUser=function(params){
      return ajaxRequest(context+"/user/userdata.do",params);
    }



    /**
     * 添加请求头,否则传过去的值为空
     * @param url
     * @param param
     * @returns {HttpPromise}
     */
    function ajaxRequest(url,param){
      return $http.post(url, param, {
        headers: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'},
        transformRequest: function (data) {
          return $.param(data);
        }
      })
    }

  });
})(angular)
